function check(dd,mystr1,mystr2)
//自动调整图片大小
{
	var imgwidth;
	var imgheight;
	imgwidth=mystr1;
	imgheight=mystr2;
	if (dd.width>imgwidth && dd.height>imgheight){
		if (dd.width/dd.height>imgwidth/imgheight){
			dd.width=imgwidth;
		}
		else
		{
			dd.height=imgheight
		}
	}
	else if(dd.width>imgwidth){
		dd.width=imgwidth
	}
	else if(dd.height>imgheight){
		dd.height=imgheight
	}
}

function externallinks() { 
	if (!document.getElementsByTagName) return; 
	var anchors = document.getElementsByTagName("a"); 
	for (var i=0; i<anchors.length; i++) { 
		var anchor = anchors[i]; 
		if (anchor.getAttribute("href") && anchor.getAttribute("rel") == "external") 
			anchor.target = "_blank"; 
	} 
}
window.onload = externallinks;

ie = (document.all)? true:false
if (ie){
function ctlent(eventobject){if(event.ctrlKey && window.event.keyCode==13){this.document.form1.submit();}}
}

function submitonce(theform){
	//if IE 4+ or NS 6+
	if (document.all||document.getElementById){
		//screen thru every element in the form, and hunt down "submit" and "reset"
		for (i=0;i<theform.length;i++){
			var tempobj=theform.elements[i]
			if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset")
			//disable em
			tempobj.disabled=true
		}
	}
}

function PageNav(vPageNo,vShowTypes){
	var Nav="";

	Nav = '<div id="pageList">';

	if (vPageNo-4<1){
		var RootPage=1;
	}
	else{
		var RootPage=vPageNo-4;
	}
	if (vPageNo+4>PUB_PageCount){
		var EndPage=PUB_PageCount;
	}
	else{
		var EndPage=vPageNo+4;
	}

	if (vPageNo==1){
		Nav+='<span class="hidden"">&laquo;</span>&nbsp;<span class="hidden">&lt;</span>&nbsp;';
	}
	else{
		Nav+='<span class="first"><a href="javascript:ShowContentList('+1+','+vShowTypes+')" title="首页">&laquo;</a></span>&nbsp;';
		Nav+='<span class="first"><a href="javascript:ShowContentList('+(vPageNo-1)+','+vShowTypes+')" title="上一页">&lt;</a></span>&nbsp;';
	}

	for (i=RootPage;i<=EndPage;i++){
		if (i==vPageNo){
			Nav+='<span class="current">['+i+']</span>&nbsp;';
		}
		else{
			Nav+='<span class="list"><a href="javascript:ShowContentList('+i+','+vShowTypes+')">['+i+']</a></span>&nbsp;';
		}
	}

	if (vPageNo==PUB_PageCount){
		Nav+='<span class="hidden">&gt;</span>&nbsp;<span class="hidden">&raquo;</span>&nbsp;';
	}
	else{
		Nav+='<span class="list"><a href="javascript:ShowContentList('+(vPageNo+1)+','+vShowTypes+')" title="下一页">&gt;</a></span>&nbsp;';
		Nav+='<span class="list"><a href="javascript:ShowContentList('+PUB_PageCount+','+vShowTypes+')" title="尾页">&raquo;</a></span>&nbsp;';
	}

	Nav+='<span class="list">' + vPageNo+'&nbsp;/&nbsp;'+PUB_PageCount+' 页</span>&nbsp;';

	Nav+='</div>';

	return Nav;
}

function ShowContentList(vPage,ShowTypes){
	var StarId=(vPage-1)*PUB_PageSize;
	var Tmp,TmpStr;
	TmpStr="";

	if ((StarId+PUB_PageSize)-1>(RCount-1)){
		var EndId=RCount-1;
	}
	else{
		var EndId=(StarId+PUB_PageSize)-1;
	}

	for (i=StarId;i<=EndId;i++){
		Tmp=ReviewList[i].split("||");
		TmpStr+='<table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">';
		if (ShowTypes==0)
		{
			TmpStr+='<tr>';
			TmpStr+='<td colspan="4" height="1" bgcolor="efefef"></td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="22" bgcolor="efefef">';
			TmpStr+='<td width="10%" align="right">发言人:</td>';
			TmpStr+='<td width="40%" align="left">&nbsp;'+Tmp[0]+'</td>';
			TmpStr+='<td width="10%" align="right">发言时间:</td>';
			TmpStr+='<td width="40%" align="left">&nbsp;'+Tmp[1]+'</td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="22">';
			TmpStr+='<td align="right" valign="top">内容:</td>';
			TmpStr+='<td colspan="3">'+Tmp[2]+'</td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="5">';
			TmpStr+='<td colspan="4"></td>';
			TmpStr+='</tr>';
		}
		else{
			TmpStr+='<tr height="22">';
			TmpStr+='<td width="10%" align="left" valign="top">'+Tmp[0]+'</td>';
			TmpStr+='<td width="30%" align="left" valign="top">'+Tmp[1]+'</td>';
			TmpStr+='<td>'+Tmp[2].substring(0,50)+'</td>';
			TmpStr+='</tr>';
			TmpStr+='<tr height="1">';
			TmpStr+='<td colspan="3" bgcolor="efefef"></td>';
			TmpStr+='</tr>';
		}
		TmpStr+='</table>';
	}

	TmpStr+='<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">';
	TmpStr+='<tr height="25">';
	TmpStr+='<td width="100%" align="right">'+PageNav(vPage,ShowTypes)+'&nbsp;</td>';
	TmpStr+='</tr>';
	TmpStr+='</table>';

	document.getElementById('CommentList').innerHTML=TmpStr;
}

function submit_vote(vote_id){
	var vote_form=document.getElementById('vote_'+vote_id);

	var target_url='vote.asp?votetype='+vote_form.votetype.value;
	target_url+='&voteid='+vote_form.voteid.value;
	target_url+='&vote=';

	for (var i=0;i<vote_form.vote.length ; i++)
	{
		if (vote_form.votetype.value==0)
		{
			if (vote_form.vote[i].checked==true)
			{
				target_url+=vote_form.vote[i].value+',';
			}
		}
		else{
			if (vote_form.vote[i].checked==true)
			{
				target_url+=vote_form.vote[i].value+',';
			}
		}
	}
	target_url=target_url.substring(0,target_url.length-1);

	return target_url;
}